package com.woniuxy.aliyunoss.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniuxy.aliyunoss.dao.ImageDao;
import com.woniuxy.aliyunoss.service.ImageService;
import com.woniuxy.commons.entity.Image;
import com.woniuxy.commons.entity.QueryEntity;
import com.woniuxy.commons.utils.ResStatus;
import com.woniuxy.commons.utils.ResponseResult;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author 雷珉
 * @date 2022年06月08日 16:30
 */
@Service
public class ImageServiceImpl implements ImageService {
    @Resource
    private ImageDao imageDao;

    @Override
    public ResponseResult<List<Image>> findByModuleAndRelatedId(String module,int relatedId) {
        List<Image> list = imageDao.findByModuleAndRelatedId(module,relatedId);
        return new ResponseResult<>(200,"查询成功",list,ResStatus.SUCCESS);
    }

    @Override
    public ResponseResult addOne(Image image) {
        imageDao.addOne(image);
        return new ResponseResult<>(200,"添加成功",null,ResStatus.SUCCESS);
    }

    @Override
    public ResponseResult deleteOne(int id) {
        imageDao.deleteOne(id);
        return new ResponseResult<>(200,"删除成功",null,ResStatus.SUCCESS);
    }
}

